<?php

use Dingo\Api\Routing\Router;
use \App\Commons\Utils\RouterActionPrefixTools;
use App\Admin\Controller\Application\ApplicationController;

/** @var Router $api */
$api = app(Router::class);

$api->group(['prefix' => 'application'], function (Router $api) {
    
    $api->group(['prefix' => 'application'], function (Router $api) {
        $rapt = new RouterActionPrefixTools(ApplicationController::class);
        
        /** @see ApplicationController::page() 用户登录接口 */
        $api->post('page', $rapt->getAction('page'))->name('应用分页');
        
        /** @see ApplicationController::store() */
        $api->post('', $rapt->getAction('store'))->name('应用新增');
        
        /** @see ApplicationController::update() */
        $api->put('/{id}', $rapt->getAction('update'))->where('id', '[0-9]+')->name('应用更新');
        
        /** @see ApplicationController::destroy() */
        $api->delete('/{id}', $rapt->getAction('destroy'))->where('id', '[0-9]+')->name('应用删除');
        
        /** @see ApplicationController::updateSecretKey() */
        $api->put('/{id}/update-secret-key', $rapt->getAction('updateSecretKey'))->where('id', '[0-9]+')->name('应用更新秘钥');
        
    });
    
});